package com.wandian.texas;

import com.wandian.texas.db.DbWatch;

/**
 * 资源池,线程互不抢占
 * @author long
 * @date 2013-1-7 下午1:31:18
 * @qq 108232706
 * @description ResPool
 */
public final class ResPool {

	/**
	 * 偏移量0,如需要访问dao，只需要调用DaoManager[]
	 */
	public final static int CallMainProcess = GameData.SERVER.CmdThreadCount;
	/**
	 * 偏移量1,
	 */
	//	public final static int CallMainProcess = GameData.SERVER.CmdThreadCount;
	private final static DbWatch[] DbWatchs = new DbWatch[GameData.SERVER.CmdThreadCount + 1];
	static {
		for (int i = 0; i < GameData.SERVER.CmdThreadCount + 1; i++) {
			DbWatchs[i] = new DbWatch();
		}
	}

	/**
	 * 返回计时器，并开始计时
	 * @param index
	 * @return
	 */
	public final static DbWatch DbWatch(int index) {
		DbWatchs[index].start();
		return DbWatchs[index];
	}
}
